<!DOCTYPE html>
<html lang="en" xmlns="http://www.thymeleaf.org">
<head>
    <title>Title</title>
    <link rel="stylesheet" th:href="@{http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css}">
    <link rel="stylesheet" th:href="@{assets/css/core.css}"/>
    <link rel="stylesheet" th:href="@{assets/css/amazeui.css}"/>
    <link rel="stylesheet" th:href="@{assets/css/menu.css}"/>
    <link rel="stylesheet" th:href="@{assets/css/index.css}"/>
    <link rel="stylesheet" th:href="@{assets/css/admin.css}"/>
    <link rel="stylesheet" th:href="@{assets/css/page/typography.css}"/>
    <link rel="stylesheet" th:href="@{assets/css/page/form.css}"/>
    <link rel="stylesheet" th:href="@{assets/css/component.css}"/>

    <link rel="stylesheet" th:href="@{https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css}">
    <script th:src="@{https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js}"></script>
    <script th:src="@{https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js}"></script>


    <!-- Favicons -->
    <link rel="icon" th:href="@{img/favicon.png}"/>
    <link rel="apple-touch-icon" th:href="@{img/apple-touch-icon.png}"/>

    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" th:href="@{lib/bootstrap/css/bootstrap.min.css}"/>

    <!--external css-->
    <link rel="stylesheet" th:href="@{lib/font-awesome/css/font-awesome.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{css/zabuto_calendar.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{lib/gritter/css/jquery.gritter.css}"/>

    <link rel="stylesheet" th:href="@{css/style.css}"/>
    <link rel="stylesheet" th:href="@{css/style-responsive.css}"/>
    <script th:src="@{lib/chart-master/Chart.js}"></script>

</head>
<body style="overflow-y:scroll;">
<section id="container">
    <!--header start-->
    <header class="header black-bg" th:replace="headBar::myHeadBar">
    </header>
    <!--header end-->

    <!--sidebar start-->
    <aside th:replace="leftSideBar::myLeftBar">

    </aside>
    <!--sidebar end-->

    <!--right begin-->

    <!--main content start-->
    <section id="main-content">
        <section class="wrapper">

            <h3><i class="fa fa-angle-right"></i> 用户管理</h3>
            <div class="row">
                <div class="col-md-12">
                    <div class="content-panel">
                        <a class="btn btn-sm btn-success" th:href="@{/addUser}" style="margin-left: 20px;">
                            新增</a>
                        <table class="am-table am-table-striped am-table-hover table-main"
                               style="border-top: ridge;margin-top: 15px;">
                            <thead>
                            <tr>
                                <th><i class="table-id"></i> ID</th>
                                <th class="table-title"><i class="fa fa-question-circle"></i> 姓名</th>
                                <th><i class="fa fa-bookmark"></i> 主题权限</th>
                                <th><i class=" fa fa-edit"></i> 操作</th>
                                <th></th>
                            </tr>
                            </thead>
                            <tbody>

                            <tr th:each="user : ${userList}">
                                <td th:text="${userStat.count}+(${curPage}-1)*${pageSize}">
                                </td>
                                <td class="hidden-phone" th:text="${user.username}"></td>
                                <td><span class="label label-info" th:text="${user.managerFlag}"></span></td>
                                <td>
                                    <a class="btn btn-primary btn-xs"
                                       th:href="@{/updateU}+${user.username}"><i
                                            class="fa fa-pencil"> 编辑</i>
                                    </a>

                                    <button class="btn btn-danger btn-xs deleteBtn"
                                            th:attr="del_uri=@{/deleteU}+${user.username}"
                                    ><i class="fa fa-trash-o "> 删除</i>
                                    </button>
                                </td>
                            </tr>

                            </tbody>
                            <div class="span6">
                                <div class="dataTables_paginate paging_bootstrap pagination">
                                    <table style="float: right">
                                        <tr>
                                            <td>
                                                        <span th:if="${curPage <=1}">
                                                            <ul class="pager">
                                                               <li><a>首页</a></li>
                                                                <li><a>上一页</a></li>
                                                            </ul>

                                                            <!--  <td> 首页</td>

                                                             <td cosplan="2">上一页</td>-->
                                                            </span>
                                            </td>
                                            <td>

                                                        <span th:if="${curPage > 1}">
                                                             <ul class="pager">
                                                               <li><a th:href="@{/user}">首页</a></li>
                                                                <li><a th:href="@{'/user?curPage='+${curPage-1}}">上一页</a></li>
                                                            </ul>

                                                            <!--   <td> <a th:href="@{/user}">首页</a>

                                                                <td> <a th:href="@{'/user?curPage='+${curPage-1}}"
                                                                        cosplan="2">上一页</a>-->
                                                            </span>
                                            </td>
                                            <td>
                                                        <span th:if="${curPage == totalPages}">
                                                             <ul class="pager">
                                                               <li><a>下一页</a></li>
                                                                <li><a>尾页</a></li>
                                                            </ul>
                                                            <!--   <td cosplan="2"> 下一页</td>
                                                                  <td>尾页</td>-->
                                                              </span>
                                            </td>
                                            <td>
                                                        <span th:if="${curPage < totalPages}">
                                                              <ul class="pager">
                                                               <li><a th:href="@{'/user?curPage='+${curPage+1}}">下一页</a></li>
                                                                <li><a th:href="@{'/user?curPage='+${totalPages}}">尾页</a></li>
                                                            </ul>
                                                            <!-- <td> <a th:href="@{'/user?curPage='+${curPage+1}}"
                                                                     cosplan="2">下一页</a></td>

                                                             <td> <a th:href="@{'/user?curPage='+${totalPages}}">尾页</a></td>-->
                                                               </span>

                                            </td>
                                        </tr>
                                    </table>

                                </div>

                            </div>

                        </table>
                        <div class="row-fluid">
                            <div class="span6">
                            </div>


                        </div>
                        <div style="margin-left: 20px;float: left;margin-top: -41px;color: #101010;">
                            共 <span th:text="${totalRows}"></span> 条记录
                            当前是第<span th:text="${curPage}"></span>页
                        </div>

                    </div>
                </div>
                <!-- /content-panel -->
            </div>
            <!-- /col-md-12 -->
            <!-- /row -->
        </section>
    </section>
    <!-- /MAIN CONTENT -->
    <!--main content end-->
    <form id="deleteForm" method="get" action="">
        <input type="hidden" name="_method" value="delete">
    </form>
    <!--right end-->

</section>


<!-- navbar -->
<a th:href="@{admin-offcanvas}" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu"
   data-am-offcanvas="{target: '#admin-offcanvas'}"><!--<i class="fa fa-bars" aria-hidden="true"></i>--></a>

<script type="text/javascript" th:src="@{assets/js/jquery-2.1.0.js}"></script>
<!--<script type="text/javascript" th:src="@{assets/js/app.js}"></script>-->
<script type="text/javascript" th:src="@{assets/js/blockUI.js}"></script>
<!--<script type="text/javascript" th:src="@{assets/js/charts/echarts.min.js}"></script>
<script type="text/javascript" th:src="@{assets/js/charts/indexChart.js}"></script>-->
<script type="text/javascript" th:src="@{assets/js/amazeui.min.js}"></script>
<script type="text/javascript" th:inline="javascript">

    $(".deleteBtn").click(function deleteUser() {
        if (confirm("确定删除吗")) {
            $("#deleteForm").attr("action", $(this).attr("del_uri")).submit();
            alert("删除成功");
            return false;
        } else {
            return false;
        }
        /*  $("#deleteForm").attr("action", $(this).attr("del_uri")).submit();
          return false;*/
    });


</script>


<script type="text/javascript" th:inline="javascript">
    $(function () {
        var URL = [[@{
            /headPic}]];
            $.ajax({
                type: "get",
                url: URL,
                data: {},
                success: function (data) {
                    console.log(data);
                    $("#headPic").attr("src", "data:image/gif;base64," + data);
                }
            });
        }
    );


</script>


<!--验证登陆者的主题主题上传权限-->

<script type="text/javascript" th:inline="javascript">
    $(function () {
        var URL = [[@{
            /checkPermission}]];
            var add = "上传";
            $.ajax({
                type: "get",
                url: URL,
                data: {
                    action: add
                },
                success: function (data) {
                    console.log(data);
                    if (0 < parseInt(data)) {
                        $("#uploadTheme").show();
                    } else {

                        $("#uploadTheme").hide();
                    }
                }
            });
        }
    )


</script>

<!--验证登陆者的主题主题查看权限-->

<script type="text/javascript" th:inline="javascript">
    $(function () {
        var URL = [[@{
            /checkPermission}]];
            var view = "查看";
            $.ajax({
                type: "get",
                url: URL,
                data: {
                    action: view
                },
                success: function (data) {
                    console.log(data);
                    if (0 < parseInt(data)) {
                        $("#viewTheme").show()
                    } else {

                        $("#viewTheme").hide()
                    }
                }
            });
        }
    )


</script>


<!--验证角色-->
<script type="text/javascript" th:inline="javascript">
    $(function () {
        var URL = [[@{
            /checkRole}]];
            $.ajax({
                type: "get",
                url: URL,
                data: {},
                success: function (data) {
                    console.log(data);
                    if (0 < parseInt(data)) {
                        var url = [[@{
                            /user}]]
                            $("#myUser").html('<a href="' + url + '" >\n' +
                                '                        <i class="fa fa-desktop"></i>\n' +
                                '                        <span >用户管理</span>\n' +
                                '                    </a>');
                            // $("#userManager").show();
                        }
                    else
                        {
                            // $("#userManager").hide();
                        }
                    }
                });
        }
    )


</script>


<!-- js placed at the end of the document so the pages load faster -->
<script th:src="@{lib/jquery/jquery.min.js}"></script>

<script th:src="@{lib/bootstrap/js/bootstrap.js}"></script>
<script class="include" type="text/javascript" th:src="@{lib/jquery.dcjqaccordion.2.7.js}"></script>
<script th:src="@{lib/jquery.scrollTo.min.js}"></script>
<script th:src="@{lib/jquery.nicescroll.js}" type="text/javascript"></script>
<script th:src="@{lib/jquery.sparkline.js}"></script>
<!--common script for all pages-->
<script th:src="@{lib/common-scripts.js}"></script>
<script type="text/javascript" th:src="@{lib/gritter/js/jquery.gritter.js}"></script>
<script type="text/javascript" th:src="@{lib/gritter-conf.js}"></script>
<!--script for this page-->
<script th:src="@{lib/sparkline-chart.js}"></script>
<script th:src="@{lib/zabuto_calendar.js}"></script>


<script type="text/javascript" th:inline="javascript">
    $(function () {
        var URL = [[@{
            /headPic}]];
            $.ajax({
                type: "get",
                url: URL,
                data: {},
                success: function (data) {
                    console.log(data);
                    $("#headPic").attr("src", "data:image/gif;base64," + data);
                }
            });
        }
    );


</script>


</body>

</html>